package cc.sheji.controller.admin;

import cc.sheji.Service.OrderService;
import cc.sheji.Service.PictureCollectionService;
import cc.sheji.Service.UserService;
import cc.sheji.domain.*;
import io.lettuce.core.RedisConnectionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.Pageable;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.HashMap;
import java.util.Map;

@Validated
@RestController
@RequestMapping(value = "/admin/v1/info")
public class AdminInfoController {

    @Autowired
    UserService userService;

    @Autowired
    OrderService orderService;
    @Autowired
    PictureCollectionService pictureCollectionService;


    @GetMapping("total")
    public JsonResult total() throws InterruptedException {

        Map<String ,Object> map=new HashMap<>();
        map.put("userNum",userService.total());
        map.put("vipNum",userService.vipNum());
        map.put("productNum",pictureCollectionService.total());
        map.put("money",orderService.total());

        return JsonResult.Success(map);
    }







}
